<template>
	<van-sidebar class="sideBar" v-model="current" @change="onChange">
		<van-sidebar-item v-for="item of sideBar" :key="item.id" :title="item.mallCateforyName"/>
	</van-sidebar>
</template>

<script>
	export default{
		props:{
			sideBar:{
				type:Array,
				required:true
			},
			sideBarCurrent:{
				type:Number,
				// default:0
			}
		},
		watch:{
			sideBarCurrent:{
				handler(idx){
					this.current = idx
				},
				immediate:true
			}
		},
		data(){
			return{
				current:this.sideBarCurrent
			}
		},
		methods:{
			onChange(idx){
				this.$emit("update:sideBarCurrent",idx)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.sideBar{
		width: 90px;
		.van-sidebar-item--select::before{
			background: none;
		}
	}
</style>
